home *** CD-ROM | disk | FTP | other *** search
/ Experimental BBS Explossion 3 / Experimental BBS Explossion III.iso / msdos / prexcm40.zip / PROTECT.BAT < prev    next >
DOS Batch File  |  1993-10-29  |  2KB  |  66 lines

  1. echo off
  2. cls
  3. if '%2'=='' goto oops
  4. if exist %1.%2 goto filefound
  5.  
  6. :oops
  7.  
  8. Rem **********************DIRECTIONS****************************
  9.  
  10. echo To use PROTECT.BAT, the first parameter is the name part of the filename
  11. echo  and the second part is the extension.
  12. echo  
  13. echo Here is an example to protect MYPROG.EXE:
  14. echo   PROTECT MYPROG EXE  (There is not dot '.' between the name & extension)
  15. echo Here is an example to protect MYPROG.COM:
  16. echo   PROTECT MYPROG COM
  17. echo  
  18. echo (Basically, just leave out the period and use a space between the
  19. echo  filename and the extension.)
  20. echo  
  21. echo Please only use this on files that have not already been compressed!!!
  22. goto end
  23.  
  24.  
  25. :filefound
  26. Rem Separate EXE from COM files
  27.  
  28. if %2==COM goto comfile
  29. if %2==com goto comfile
  30. if %2==Com goto comfile
  31. if %2==COm goto comfile
  32. if %2==cOM goto comfile
  33. if %2==cOm goto comfile
  34. if %2==coM goto comfile
  35. if exist %1.old del %1.old >NUL
  36. if exist %1.tmp del %1.tmp >NUL
  37.  
  38. rem You can use PKLITE below, but use the -B (Backup) option and change
  39. rem the suffixes from .OLD to .BAK as in:
  40. rem  
  41. rem    PKLite %1.EXE -B
  42. rem    ren %1.Bak %1.Old
  43. rem  
  44. LZEXE %1.EXE 
  45. if exist %1.old goto exenormal
  46. echo %1.EXE Could Not Be Compressed By LZEXE...
  47. goto end    
  48. :exenormal
  49.  
  50. ren %1.old %1.tmp
  51. protexcm %1.EXE %3
  52. del %1.old >NUL
  53. ren %1.tmp %1.old
  54. echo %1.EXE has been protected, %1.OLD is the original!
  55. goto end
  56.  
  57.  
  58. :comfile
  59. rem If you wish to use PKLITE, make the following changes:
  60. rem PKLITE %1.COM -B
  61. rem REN %1.OLD %1.BAK
  62. protexcm %1.COM %3
  63. rem DEL %1.OLD
  64. rem REN %1.BAK %1.OLD
  65.  
  66. :end